﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SaleDiscount.Portal.eBay;
using eBay.Service.Core.Sdk;

namespace SaleDiscount.Portal
{
    public partial class EBayFectchToken_Iframe : System.Web.UI.Page
    {
        string EbayUserName
        {
            get
            {
                if (Session["CurrentUser"] == null) return string.Empty;
                return Session["CurrentUser"].ToString();
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

            //update Token
            ApiContext context = eBaySession.LoadEmptyApiContext(EbayUserName);

            Session["sessionId"] = eBaySession.GetSessionId(context, ApiContextLoader.LoadAppConfig("RunName"));


            Response.Redirect(ApiContextLoader.LaunchSignInPage(context, Session["sessionId"].ToString()));
        }
    }
}